package com.leilei.source.rabbit;


import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.connectors.rabbitmq.common.RMQConnectionConfig;

/**
 * @author lei
 * @version 1.0
 * @desc
 * @date 2021-03-15 17:31
 */
public class FlinkSourceByRabbitMq {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        RMQConnectionConfig connectionConfig = new RMQConnectionConfig.Builder()
                .setHost("10.50.40.116")
                .setPort(5673)
                .setUserName("admin")
                .setPassword("admin")
                .setVirtualHost("/")
                .build();
        DataStreamSource dataStreamSource = env.addSource(new FlinkRabbitMqSource(connectionConfig,
                "leilei",
                "paas-trans-enterprise-platform-data.fanout.location_test"));
        dataStreamSource.print();
        env.execute();
    }
}
